home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
tcl
/
tcl70b2.lha
/
tcl7.0b2
/
doc
/
format.n
< prev
next >
Wrap
Text File
|
1993-07-17
|
3KB
|
73 lines
'\"
'\" Copyright (c) 1993 The Regents of the University of California.
'\" All rights reserved.
'\"
'\" Permission is hereby granted, without written agreement and without
'\" license or royalty fees, to use, copy, modify, and distribute this
'\" documentation for any purpose, provided that the above copyright
'\" notice and the following two paragraphs appear in all copies.
'\"
'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
'\"
'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
'\"
'\" $Header: /user6/ouster/tcl/man/RCS/format.n,v 1.2 93/07/17 15:39:01 ouster Exp $ SPRITE (Berkeley)
'\"
.so man.macros
.HS format tcl
.BS
'\" Note: do not modify the .SH NAME line immediately below!
.SH NAME
format \- Format a string in the style of sprintf
.SH SYNOPSIS
\fBformat \fIformatString \fR?\fIarg arg ...\fR?
.BE
.SH DESCRIPTION
.PP
This command generates a formatted string in the same way as the
ANSI C \fBsprintf\fR procedure (it uses \fBsprintf\fR in its
implementation).
\fIFormatString\fR indicates how to format the result, using
\fB%\fR conversion specifiers as in \fBsprintf\fR, and the additional
arguments, if any, provide values to be substituted into the result.
Each \fIarg\fR must match the expected type
from the corresponding conversion specifier in \fIformatString\fR;
the \fBformat\fR command converts each argument to the correct
type (floating, integer, etc.) before passing it to \fBsprintf\fR
for formatting.
The return value from \fBformat\fR is the formatted string.
.PP
.VS
The conversion specifiers for \fBformat\fR are identical in syntax
and effect to those for \fBsprintf\fR except for the following
differences:
.IP [1]
\fB%p\fR and \fB%n\fR specifiers are not currently supported.
.VE
.IP [2]
For \fB%c\fR conmversions the argument must be a decimal string,
which will then be converted to the corresponding ASCII character value.
.IP [3]
.VS
The \fBl\fR modifier is ignored; integer values are always converted
as if there were no modifier present and real values are always
converted as if the \fBl\fR modifier were present (i.e. type
\fBdouble\fR is used for the internal representation).
If the \fBh\fR modifier is specified then integer values are truncated
to \fBshort\fR before conversion.
.PP
The \fBformat\fR command also supports the XPG3 ``%n$'' positional
specifiers.
.VE
.SH KEYWORDS
format, sprintf, string, substitution